<template>
  <view class="container">
    <uni-nav-bar title="销售订单详情" background-color="#fff" fixed statusBar :border="false" height="88rpx" left-icon="left"
      @clickLeft="onClickLeft"></uni-nav-bar>
    <view class="content">
      <!-- <view class="item" v-for="(item, index) in orderList" :key="index">
        <view class="title" style="width: 100%;">
          订单编号：{{ item.orderNumber }}
        </view>
        <view class="money" style="width: 100%;">
          分润金额：{{ item.profitAmount }} 元
        </view>
        <view class="time" style="width: 100%;">
          下单时间：{{ item.sellTime | parseTime('YYYY-MM-DD HH:mm:ss') }}
        </view> -->
        <uni-table ref="table" border stripe emptyText="暂无更多数据">
          <uni-tr>
            <uni-th align="center">商品名称</uni-th>
            <uni-th align="center">商品类型</uni-th>
            <uni-th align="center">数量</uni-th>
            <uni-th align="center">售价（元）</uni-th>
            <uni-th align="center">进价（元）</uni-th>
            <uni-th align="center">商品利润</uni-th>
          </uni-tr>
          <uni-tr v-for="(it, index) in orderList" :key="index">
            <uni-td align="center">{{ it.name }}</uni-td>
            <uni-td align="center" v-if="it.type == '0'">标品</uni-td>
            <uni-td align="center" v-if="it.type == '1'">非标品</uni-td>
            <uni-td align="center" v-if="it.type == '2'">自营</uni-td>
            <uni-td align="center" v-if="it.type == '3'">临时</uni-td>
            <uni-td align="center" v-if="it.type == '4'">期初</uni-td>
            <uni-td align="center">{{ it.count }}</uni-td>
            <uni-td align="center">{{ it.sellPrice }}</uni-td>
            <uni-td align="center">{{ it.outboundPrice }}</uni-td>
            <uni-td align="center">{{ it.profitAmount }}</uni-td>
          </uni-tr>
        </uni-table>
      <!-- </view> -->
    </view>
  </view>
</template>

<script>
import { reqSalesOrderDetail } from '@/apis/member.js'
export default {
  name: "BillFlowDetail",
  data() {
    return {
      id: '',
      orderList: [],
    }
  },
  onLoad(params) {
    this.id = params?.id;
    console.log('销售订单详情id', this.id);
    this.getDivideDetail();
  },
  methods: {
    async getDivideDetail() {
      let res = await reqSalesOrderDetail({ id: this.id });
      if (res.code === 200) {
        console.log('销售订单详情', res.data);
        this.orderList = res.data;
      }
    }
  },
}
</script>

<style>
page {
  background: #f7f7f7;
}
</style>

<style lang="scss" scoped>
.content {
  padding: 0 20rpx;
  padding-top: 20rpx;
  box-sizing: border-box;

  .item {
    display: flex;
    flex-wrap: wrap;
    padding: 20rpx 20rpx;
    box-sizing: border-box;
    background-color: #fff;
    margin-bottom: 15rpx;
    border-radius: 10rpx;

    &:last-child {
      margin-bottom: 0;
    }

    .title,
    .money,
    .time {
      margin-bottom: 20rpx;
      font-size: $uni-font-size-unBase;
    }
  }
}

.uni-table-th,
.uni-table-td {
  padding: 16rpx 10rpx;
}

.uni-table-td {
  line-height: 20rpx;
}

.uni-table-scroll {
  box-sizing: border-box;
}
</style>